package com.gjy.spring.s3;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2023-12-19 09:19:10
 */
@Component
public class LifeCycleBean {

    private static final Logger log = LoggerFactory.getLogger(LifeCycleBean.class);

    public LifeCycleBean() {
        log.info("LifeCycleBean 构造方法");
    }

    @Autowired
    public void autowire(@Value("${JAVA_HOME}") String home) {
        log.info("LifeCycleBean 依赖注入: {}", home);
    }

    @PostConstruct
    public void init() {
        log.info("LifeCycleBean init 方法");
    }

    @PreDestroy
    public void destroy() {
        log.info("LifeCycleBean destroy 方法");
    }
}
